﻿package src.panel 
{
	import debugs.Debug;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author keys_star@163.com
	 */
	public class scrollNum extends Sprite
	{
		public var txt1:TextField;
		public var txt0:TextField;
		public var ID:int= 1;
		private var dy:Number = -2;
		public function scrollNum() 
		{
			txt1.text = ID.toString();
			start(0);
		}
		public function run(e:Event) :void {
			var n = Number(txt1.text);
			var ln = n;
			txt0.y += dy;
			txt1.y = txt0.y + txt0.height;
			if (txt1.y <= 0) {
				txt0.y = -txt0.height;
				this.removeEventListener(Event.ENTER_FRAME, run);
			}
		}
		public function start(id:int) {
			Debug.send(this + ".id " + id + "." + ID);
			if(ID!=id){
				ID = id;
				txt0.y = 0;
				txt0.text = txt1.text;
				txt1.text = id.toString();
				this.addEventListener(Event.ENTER_FRAME, run);
			}
		}
	}
}